//
//  ActionSheet.m
//  Kids
//
//  Created by LiTengFei on 14/11/26.
//  Copyright (c) 2014年 90's Technology Co.Ltd. All rights reserved.
//

#import "ActionSheet.h"

@implementation ActionSheet

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background2"]];
    
    
        UIButton * button =({
            
            UIButton * button = [[UIButton alloc]initWithFrame:CGRectMake(20, 10, 280, 50)];
            [button setTitle:@"使用条款" forState:UIControlStateNormal];
            [button setBackgroundImage:[UIImage imageNamed:@"yellow4"] forState:UIControlStateNormal];
            [button setBackgroundImage:[UIImage imageNamed:@"yellow4_press"] forState:UIControlStateHighlighted];
            button;
            
        });
        UIButton * button2 =({
            
            UIButton * button = [[UIButton alloc]initWithFrame:CGRectMake(20, 70, 280, 50)];
            [button setTitle:@"隐私政策" forState:UIControlStateNormal];
            [button setBackgroundImage:[UIImage imageNamed:@"yellow4"] forState:UIControlStateNormal];
            [button setBackgroundImage:[UIImage imageNamed:@"yellow4_press"] forState:UIControlStateHighlighted];
            button;
            
        });
        UIButton * button3 =({
            
            UIButton * button = [[UIButton alloc]initWithFrame:CGRectMake(20, 135, 280, 50)];
            [button setBackgroundImage:[UIImage imageNamed:@"cancel_button"] forState:UIControlStateNormal];
            [button setBackgroundImage:[UIImage imageNamed:@"cancel_button_press"] forState:UIControlStateHighlighted];
            button;
            
        });
        
        [self addSubview:button];
        [self addSubview:button2];
        [self addSubview:button3];
    }
    return self;
}
-(void)showFromView:(UIView *)view{

    
    self.frame = CGRectMake(0, CGRectGetHeight(view.frame), CGRectGetWidth(view.frame), CGRectGetHeight(self.frame));
    
    [view addSubview:self];
    
    CGFloat duration = 0.3;
    self.multipleTouchEnabled =NO;
    [UIView animateWithDuration:duration animations:^{
        
        
        self.frame = CGRectMake(0, CGRectGetHeight(view.frame) - 200 - 64, CGRectGetWidth(view.frame), 300);
    } completion:^(BOOL finished) {
       
    }];
    
    
}
@end
